# @Time    : 2025-04-11 13:40
# @Author: Fioman
# @Phone  : 13149920693
# @Tips      : Talk is cheap,show me the code ^_^
import requests

from FirstLesson import crawler_config

url = "https://movie.douban.com/j/chart/top_list"

headers = {
    "User-Agent":crawler_config.userAgent,
}

# 重新封装请求参数
param = {
    "type": "24",
    "interval_id": "100:90",
    "action": "",
    "start": 0,
    "limit": 20
}

resp = requests.get(url, params=param,headers=headers)
if resp.status_code > 200:
    print("请求失败,错误的响应码:", resp.status_code)
else:
    print("请求成功,响应内容:", resp.json())
    print(resp.request.url)
    resp.close() # 关闭响应对象,请求一次就关闭掉